package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.testDeal.domain.testYs.JkSbJg;
import com.ruoyi.testDeal.service.IJkSbJgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 金属非金属水泵数据结果Controller
 *
 * @author ruoyi
 * @date 2024-04-09
 */
@RestController
@RequestMapping("/testDeal/jkSbJgInfo")
public class JkSbJgController extends BaseController
{
    @Autowired
    private IJkSbJgService jkSbJgService;

    /**
     * 查询金属非金属水泵数据结果列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbJgInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(JkSbJg jkSbJg)
    {
        startPage();
        List<JkSbJg> list = jkSbJgService.selectJkSbJgList(jkSbJg);
        return getDataTable(list);
    }

    /**
     * 导出金属非金属水泵数据结果列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbJgInfo:export')")
    @Log(title = "金属非金属水泵数据结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkSbJg jkSbJg)
    {
        List<JkSbJg> list = jkSbJgService.selectJkSbJgList(jkSbJg);
        ExcelUtil<JkSbJg> util = new ExcelUtil<JkSbJg>(JkSbJg.class);
        util.exportExcel(response, list, "金属非金属水泵数据结果数据");
    }

    /**
     * 获取金属非金属水泵数据结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbJgInfo:query')")
    @GetMapping(value = "/{sbResultId}")
    public AjaxResult getInfo(@PathVariable("sbResultId") Long sbResultId)
    {
        return success(jkSbJgService.selectJkSbJgBySbResultId(sbResultId));
    }

    /**
     * 新增金属非金属水泵数据结果
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbJgInfo:add')")
    @Log(title = "金属非金属水泵数据结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkSbJg jkSbJg)
    {
        return toAjax(jkSbJgService.insertJkSbJg(jkSbJg));
    }

    /**
     * 修改金属非金属水泵数据结果
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbJgInfo:edit')")
    @Log(title = "金属非金属水泵数据结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkSbJg jkSbJg)
    {
        return toAjax(jkSbJgService.updateJkSbJg(jkSbJg));
    }

    /**
     * 删除金属非金属水泵数据结果
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbJgInfo:remove')")
    @Log(title = "金属非金属水泵数据结果", businessType = BusinessType.DELETE)
    @DeleteMapping("/{sbResultIds}")
    public AjaxResult remove(@PathVariable Long[] sbResultIds)
    {
        return toAjax(jkSbJgService.deleteJkSbJgBySbResultIds(sbResultIds));
    }
}
